﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter13.Code05.Code02
{
    public class Demo
    {
        public static void Begin()
        {
            Type classType = typeof(DecoratedCalss);
            object[] customAttributes = classType.GetCustomAttributes(true);
            foreach (object customAttribute in customAttributes)
            {
                Console.WriteLine("Attribute of type {0} found.", customAttribute);
                DoesInterestingThingsAttribute interestingAttribute = customAttribute as DoesInterestingThingsAttribute;
                if (interestingAttribute != null)
                {
                    Console.WriteLine("This class does {0} * {1}!", interestingAttribute.WhatDoesItDo, interestingAttribute.HowManyTimes);
                }
            }
        }
    }
}
